// JavaScript Document
function uploadSingleFile() {
	var xmlhttp;
	if (window.XMLHttpRequest) {
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp = new XMLHttpRequest();	
	}
	else {
		// code for IE5, IE6
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");	
	}
	
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			document.getElementById("uploadResult").innerHTML=xmlhttp.responseText;	
		}
	}
	var photo = document.getElementById("coverPic");
	var file = photo.files[0];
	//xmlhttp.open("POST", "", true);
	//xmlhttp.send();
	alert("ajax upload..");
}

function splitFile()
{
    var file = $("#upfile").val();
    if(!file){
        return false;
    }

    file = file.replace(/\\/g, "/");
    var parts = file.split("/");
    var filename = parts[parts.length - 1];

    var bits = filename.split(".");
    var ext = bits[bits.length - 1];

    $("#filename").val(filename);
    $("#fileext").val(ext.toLowerCase());
    return true;
}